import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TaskFollowCollaboratorVO, TaskFollowCollaboratorForm, TaskFollowCollaboratorQuery } from '@/api/task/taskFollowCollaborator/types';

/**
 * 查询任务关联跟进人列表
 * @param query
 * @returns {*}
 */

export const listTaskFollowCollaborator = (query?: TaskFollowCollaboratorQuery): AxiosPromise<TaskFollowCollaboratorVO[]> => {
  return request({
    url: '/task/taskFollowCollaborator/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询任务关联跟进人详细
 * @param id
 */
export const getTaskFollowCollaborator = (id: string | number): AxiosPromise<TaskFollowCollaboratorVO> => {
  return request({
    url: '/task/taskFollowCollaborator/' + id,
    method: 'get'
  });
};

/**
 * 新增任务关联跟进人
 * @param data
 */
export const addTaskFollowCollaborator = (data: TaskFollowCollaboratorForm) => {
  return request({
    url: '/task/taskFollowCollaborator',
    method: 'post',
    data: data
  });
};

/**
 * 修改任务关联跟进人
 * @param data
 */
export const updateTaskFollowCollaborator = (data: TaskFollowCollaboratorForm) => {
  return request({
    url: '/task/taskFollowCollaborator',
    method: 'put',
    data: data
  });
};

/**
 * 删除任务关联跟进人
 * @param id
 */
export const delTaskFollowCollaborator = (id: string | number | Array<string | number>) => {
  return request({
    url: '/task/taskFollowCollaborator/' + id,
    method: 'delete'
  });
};
